package club.janna.diveinspringboot.autoconfigure.service.impl;

import club.janna.diveinspringboot.autoconfigure.service.CalculateService;
import org.springframework.context.annotation.Profile;
import org.springframework.stereotype.Service;

@Profile("java7")
@Service
public class Java7CaclulateServiceImpl implements CalculateService {
    @Override
    public int sum(int... arr) {
        System.out.println("java7 使用for循环实现");
        int sum = 0;
        for (int i : arr) {
            sum += i;
        }
        return sum;
    }
}
